﻿<!-- #include file="mymin.asp" -->
<title>会员状态管理</title></head><body><div class='main400'>
<%

dim id,rs,status,count,rss,a
id=getN("id",1)
a=getN("a",0)
If a=0 Then
	set rs=Server.CreateObject("ADODB.Recordset")
	rs.open"select status from 74hu_user where ID="&id,myconn,1,1
	If Not rs.eof Then
		status=rs("status")'暂时只有加黑(3)和未加黑(0)
		w "会员ID："&id&"<br/>"
		If status <> 3 Then
			w "<form action='status.asp?sid="&sid&"&amp;a=1&amp;id="&id&"' method='post'>当前状态：正常使用<br/>"&_
				"刑期：<input name=""days"" value="""" size='6' maxlength=""16""/>(天)<br/>"&_
				"理由：<input name=""reason"" value="""" maxlength=""16""/><br/>"&_
				"<input type='submit' value='加黑会员'/><br/>"&_
				"温馨提示：<br/>"&_
				"刑期：会员服刑时间，过期可申请出狱<br/>"&_
				"理由：加黑会员理由，提供该会员查看"
		Else
			w "当前状态：入狱中<br/>"
			set rss=Server.CreateObject("ADODB.Recordset")
			rss.open"select top 1 days,savetime,remark from 74hu_prison where status=0 and userid="&id,myconn,1,1
			If Not rss.eof Then
				w "入狱时间："&rss("savetime")&"<br/>"&_
					"刑期："&rss("days")&"天<br/>"&_
					"理由："&rss("remark")&"<br/>"&_
					"<a href='status.asp?sid="&sid&"&amp;id="&id&"&amp;a=11'>提前释放</a>"
			Else
				w "入狱情况不详"
			End If
			Set rss=Nothing
		End If
	Else
		w "没有这个会员！"
	End If
	rs.close
	set rs=nothing
Elseif a=1 Then
	'加黑会员
	Dim reason,days
	days=getData("days")
	reason=getData("reason")
	If days="" Or IsNumeric(days) =  False Then
		w "请填写加黑的天数"
	Elseif days<0 Or days>36500 Then
		w "请填写有效的天数"
	Else
		If reason="" Then
			w "请填写加黑的理由"
		Else
			count=myconn.Execute("select count(id) from 74hu_prison where userid="&id&" and status=0")(0)
			If count<>0 Then
				w "用户已服刑，请不要重复加黑！"
			Else
				myconn.Execute("insert into 74hu_prison(userid,status,savetime,days,remark,hunter) values("&id&",0,'"&time_now&"',"&days&",'"&reason&"',0)")
				myconn.Execute("update 74hu_user set status=3 where id="&id)
				msg = "很抱歉，你因为"""&reason&"""被管理员抓进监狱，拘留"&days&"天。"
				Call sendMsgToUser(id, msg)
				w "加黑会员成功！"
			End If
		End If
	End If
Elseif a=11 Then
	'释放会员
	If getData("b")="" Then
		w "你确定释放会员？<br/><a href='status.asp?sid="&sid&"&amp;id="&id&"&amp;a=11&amp;b=1'>是，提前释放</a>"
	Else
		myconn.Execute("update 74hu_prison set status=1 where status=0 and userid="&id)
		myconn.Execute("update 74hu_user set status=0 where id="&id)
		msg = "恭喜，你被管理员提前释放。"
		Call sendMsgToUser(id, msg)
		w "会员(ID:"&id&")已提前释放！"
	End If
End If
w "<br/><a href=""detail.asp?sid="&sid&"&amp;id="&id&""">返回管理</a><br/>----------<br/><a href=""member.asp?sid="&sid&"&amp;"">[会员总管]</a>"

call bbsLast
%>